<?php
session_start();
include("../service/bannerService.php");
include("../util/constant.php");
include_once("../util/FTP.php");

$proId = $_POST["product"];
$status = $_POST["status"];
$type = 5;
$image = "";

$bannerId = createNewProductBanner($image, $type, $status, $proId);

if($bannerId > 0){
	if(IS_ON_SERVER) FTP::getInstance()->ftpMakeDir(FTP::getInstance()->getServerPath()."product/special/".$bannerId, 0777);
    else mkdir("../image/banner/new-product-banner/".$bannerId, 0777);
	echo "<script>window.location.href = '../admin/new-product-banner-detail.php?action=".INSERT_SUCCESSFULLY."&id=".$bannerId."';</script>";
} else {
	echo "<script>window.location.href = '../admin/new-product-banner-detail.php?action=".INSERT_FAILED."&id=".$bannerId."';</script>";
}
?>